package com.naiterui.ehp.bs.cms.modules.wms.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.security.annotation.SysLog;
import com.naiterui.ehp.bs.cms.common.controller.AbstractController;
import com.naiterui.ehp.bs.cms.common.vo.PageParamsVO;
import com.naiterui.ehp.bs.cms.common.vo.PageVO;
import com.naiterui.ehp.bs.cms.modules.wms.service.IProductService;
import com.naiterui.ehp.bs.cms.modules.wms.vo.ProductVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@Api(tags = {SwaggerTag.CMS + SwaggerTag.MEDICINE_DRUG})
@RequestMapping("wms/product")
public class ProductController extends AbstractController {

    @Autowired
    private IProductService productService;

    /**
     * 列表
     *
     * @return
     */
    @SysLog("商品列表")
    @GetMapping("/list")
    @ApiOperation(value = "商品列表")
    @PreAuthorize("@p.check('wms:product:list')")
    public PageVO<ProductVO> list(PageParamsVO pageParamsVO, ProductVO productVO) {
        return this.productService.queryPage(pageParamsVO, productVO);
    }
}
